package cn.cxy.exec;

import java.util.Scanner;

/**
 * @Author 金帮嘉诚
 * @Date 2021-06-09 周三 21:01
 */
public class TestBMI {
    public static void main(String[] args) {
        System.out.println("请输入身高(m)：");
        double height=new Scanner(System.in).nextDouble();
        System.out.println("请输入体重(kg)：");
        double weight=new Scanner(System.in).nextDouble();

        calculateBMI(height,weight);
    }
    public static void calculateBMI(double height,double weight){
        String r="";
        double BMI=weight/(height*height);

        if (BMI<=18.5&&BMI>=0){
            r="过轻";
        }else if (BMI<=22.9){
            r="正常";
        }else if (BMI<=24.9){
            r="偏胖";
        }else if (BMI<=29.9){
            r="肥胖";
        }else if (BMI<=40){
            r="重度肥胖";
        }else {
            r="极度肥胖";
        }
        System.out.println("您的BMI指数 = " + BMI);
        System.out.println("您的体重属于 = " + r);
    }
}
